package com.bzframework.movierecommend.client.tmdb;

import com.bzframework.movierecommend.client.tmdb.config.TMDBApiConfiguration;
import com.bzframework.movierecommend.client.tmdb.resp.GenresResp;
import com.bzframework.movierecommend.client.tmdb.resp.PopularMovieResp;
import com.bzframework.movierecommend.client.tmdb.resp.SearchMovieResp;
import com.bzframework.movierecommend.client.tmdb.resp.TMDBPageBaseResp;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;

@FeignClient(
        name = "tmdb-client",
        url = "${movie.tmdb.base-url}",
        configuration = TMDBApiConfiguration.class
)
public interface TMDBClient {

    /**
     *
     * @see SearchMovieResp
     * <a href="https://developer.themoviedb.org/reference/search-movie">...</a>
     * @param query 按原始标题、翻译标题和替代标题搜索电影
     * @param page 分页
     * @param language 语言 zh-CN 中文  en-US 英文
     */
    @GetMapping("/search/movie")
    TMDBPageBaseResp searchMovie(@RequestParam("query") String query, @RequestParam("page") Integer page,
                                 @RequestParam("language") String language);


    @GetMapping("/discover/movie")
    TMDBPageBaseResp discoverMovie(@RequestParam("query") String query, @RequestParam("page") Integer page,
                                   @RequestParam("language") String language);

    /**
     * 获取电影类型
     * @param language zh-CN
     */
    @GetMapping("/genre/movie/list")
    GenresResp getMovieGenres(@RequestParam("language") String language);

    /**
     * 获取电影详情
     * @param movieId 电影id
     * @param language language
     */
    @GetMapping("/movie/{movieId}")
    Object getMovieById(@PathVariable("movieId") String movieId, @RequestParam("language") String language);


    /**
     * 获取演员阵容
     * @param movieId 电影id
     * @param language 语言
     */
    @GetMapping("/movie/{movie_id}/credits")
    Object getMovieCredits(@PathVariable("movie_id") String movieId, @RequestParam("language") String language);

    /**
     * @see PopularMovieResp
     * 获取流行电影
     * @param page 分页参数
     * @param language language
     */
    @GetMapping("/movie/popular")
    TMDBPageBaseResp getPopularMovies(@RequestParam("page") Integer page, @RequestParam("language") String language);


    /**
     * 获取正在上映的电影列表
     * @param page 分页参数
     * @param language language
     */
    @GetMapping("/movie/now_playing")
    TMDBPageBaseResp getNowPlayingMovies(@RequestParam("page") Integer page, @RequestParam("language") String language);

    /**
     * 获取TMDB上用户评分最高的电影
     * @param page 分页参数
     * @param language language
     */
    @GetMapping("/movie/top_rated")
    TMDBPageBaseResp getTopRatedMovies(@RequestParam("page") Integer page, @RequestParam("language") String language);

    /**
     * 获取即将在影院上映的电影
     * @param page 分页参数
     * @param language language
     */
    @GetMapping("/movie/upcoming")
    TMDBPageBaseResp getUpcomingMovies(@RequestParam("page") Integer page, @RequestParam("language") String language);

    /**
     * 根据电影id推荐相似的电影
     * @param movieId 电影id
     * @param page 分页参数
     * @param language language
     */
    @GetMapping("/movie/{movieId}/similar")
    TMDBPageBaseResp getSimilarMovies(@PathVariable() String movieId, @RequestParam("page") Integer page,
                                      @RequestParam("language") String language);


    @GetMapping("/movie/{movieId}/videos")
    Object getMovieVideo(@PathVariable("movieId") String movieId, @RequestParam("language") String language);

}
